package com.android.canvasproject.view.fragments;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.android.canvasproject.R;

public class PostitDialog extends DialogFragment {

	private View view;

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
		LayoutInflater inflater = getActivity().getLayoutInflater();
		view = inflater.inflate(R.layout.dialog_internal_postit, null);

		builder.setView(view);
		builder.setPositiveButton("OK", null);

		return builder.create();
	}
	
	@Override
	public void onStart() {
		super.onStart();
		AlertDialog form = (AlertDialog) getDialog();
		
		if(form == null)
			return;

		Button buttonPositive = form.getButton(Dialog.BUTTON_POSITIVE);
		buttonPositive.setBackgroundResource(R.drawable.selector_button_common);

		int dialogWidth = (int) (getActivity().getResources().getDisplayMetrics().widthPixels * 0.8);
		int dialogHeight = (int) (getActivity().getResources().getDisplayMetrics().heightPixels * 0.95);

		getDialog().getWindow().setLayout(dialogWidth, dialogHeight);
	}
}